package com.clqteam.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.collections.bag.SynchronizedSortedBag;

import com.clqteam.service.DeleteSupplierService;
import com.clqteam.serviceimpl.DeleteSupplierServiceImpl;
/**
 * 供应商管理（删除功能）lxg
 * @author Administrator
 *
 */
public class DeleteSupplierController extends HttpServlet{
	//创建service层的对象，父类引用子类对象
	DeleteSupplierService dss=new DeleteSupplierServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		resp.setCharacterEncoding("utf8");

		req.setCharacterEncoding("utf8");


		//获取req带过来的值supId
		String supid=req.getParameter("supId");
		int supId=Integer.parseInt(supid);
		//引用service层的方法
		boolean delete=dss.deleteSupplierBySupId(supId);
		PrintWriter pw=resp.getWriter();
		if(delete=true){
			pw.write("1");
		}else{
			pw.write("0");
		}
		pw.flush();
		pw.close();
	}
	
}
